// pages/MineNew/MineNew.js
Page({

   /**
    * 页面的初始数据
    */
   data: {
    footer: {},
    electricianCode: "",
    unreadNum: 0,
   },

   /**
   * 初始化底部Tab数据
   */
  getfooter: function () {
    var that = this
    wx.getStorage({
        key: 'electricianCode',
        success: (RES) => {
            this.setData({
                electricianCode: RES.data.electricianCode,
            });
            console.log('electricianCode为', RES.data.electricianCode)
            wx.request({
                url: api.findUnread,
                method: 'POST',
                data: {
                    electricianCode: that.data.electricianCode,
                },
                success: function (res) {
                    if (res.data.code == 200) {
                        that.setData({
                            unreadNum: res.data.data.unreadNum,
                        }),
                        console.log("未读消息数量:", that.data.unreadNum)
                        var footerList = {
                            footerTab: 2,
                            footerlist: [{
                              diy_name: "系统首页",
                              color: '#221915',
                              img: "",
                              selimg: "",
                              link: "/pages/FirstPage/FirstPage",
                              unreadNum: that.data.unreadNum,
                            }, {
                              diy_name: "我的工单",
                              color: '#221915',
                              img: "",
                              selimg: "",
                              link: "/pages/MyList/MyList"
                            },{
                              diy_name: "个人中心",
                              color: '#221915',
                              img: "",
                              selimg: "",
                              link: "/pages/Mine/Mine"
                            }]
                          }
                        that.setData({
                            footer: footerList
                        })
                    }

                }
            })
        },
    });



},
  getfooter: function () {
    var t = this;
    var footerList = {
      footerTab: 2,
      footerlist: [{
        diy_name: "系统首页",
        color: '#221915',
        img: "",
        selimg: "",
        link: "/pages/FirstPage/FirstPage"
      }, {
        diy_name: "我的工单",
        color: '#221915',
        img: "",
        selimg: "",
        link: "/pages/MyList/MyList"
      },{
        diy_name: "个人中心",
        color: '#221915',
        img: "",
        selimg: "",
        link: "/pages/Mine/Mine"
      }]
    }
    t.setData({
      footer: footerList
    })
  },

   /**
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
    this.getfooter();
   },

   /**
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady() {

   },

   /**
    * 生命周期函数--监听页面显示
    */
   onShow() {

   },

   /**
    * 生命周期函数--监听页面隐藏
    */
   onHide() {

   },

   /**
    * 生命周期函数--监听页面卸载
    */
   onUnload() {

   },

   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
   onPullDownRefresh() {

   },

   /**
    * 页面上拉触底事件的处理函数
    */
   onReachBottom() {

   },

   /**
    * 用户点击右上角分享
    */
   onShareAppMessage() {

   }
})